package cn.ldw.vo;

public class Result {
    private int code;

    private Object data;

    private String message;

    private boolean success;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public Result(int code, Object data, String message, boolean success) {
        this.code = code;
        this.data = data;
        this.message = message;
        this.success = success;
    }

    public static Result success(Object data) {
        Result result = new Result(200, data, "success", true);
        return  result;
    }

    public static Result fail(int code, String message) {
        Result result = new Result(code, null, message, false);
        return result;
    }
}
